package cn.dankal.flyaudio.adapter;

import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;

import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewAdapter;
import cn.dankal.basiclib.base.recyclerview.BaseRecyclerViewHolder;
import cn.dankal.basiclib.pojo.UserScoresLogsEntity;
import cn.dankal.flyaudio.R;
import cn.dankal.flyaudio.configs.ScoreTypeConfigs;

public class ScoreRecordAdapter extends BaseRecyclerViewAdapter<UserScoresLogsEntity> {

    /**
     *  REGISTERED(true, false),//注册送积分
     *     COMPLETE_USER_INFO(true, false),//完成资料
     *     BIND_WECHAT(true, false),//绑定微信
     *     BIND_EMAIL(true, false),//绑定邮箱
     *     SIGN_IN(true, false),//签到
     *     INVITE_USER(true, false),//邀请用户
     *     JOIN_ACTIVITY(true, false),//参加活动
     *     COMMENT_ZIXUN(true, false),//评论资讯
     *     COMMENT_CIKE(true, false),//评论此刻
     *
     *     ADD_ORDER(false, true),//下单
     *     CANCEL_ORDER(true, true, true),//订单取消
     *     TRANSFER_MINUS(false, false),//发红包
     *     CANCEL_TRANSFER_MINUS(true, false, true),//红包过期退回
     *     TRANSFER_PLUS(true, false),//收到红包
     * @param viewType
     * @return
     */

    @Override
    protected int getLayoutResId(int viewType) {
        return R.layout.item_score_record;

    }

    @Override
    protected BaseRecyclerViewHolder getViewHolder(ViewGroup parent, View rootView, int viewType) {
        return new ScoreRecordViewHolder(rootView);
    }

    public class ScoreRecordViewHolder extends BaseRecyclerViewHolder<UserScoresLogsEntity>{

        public ScoreRecordViewHolder(View itemView) {
            super(itemView);
        }

        @Override
        public void onBindData(UserScoresLogsEntity data, int position) {

            if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.REGISTERED.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.REGISTERED.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.COMPLETE_USER_INFO.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.COMPLETE_USER_INFO.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.BIND_EMAIL.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.BIND_EMAIL.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.BIND_WECHAT.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.BIND_WECHAT.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.SIGN_IN.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.SIGN_IN.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.INVITE_USER.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.INVITE_USER.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.JOIN_ACTIVITY.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.JOIN_ACTIVITY.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.COMMENT_ZIXUN.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.COMMENT_ZIXUN.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.COMMENT_CIKE.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.COMMENT_CIKE.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.ADD_ORDER.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.ADD_ORDER.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.CANCEL_ORDER.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.CANCEL_ORDER.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.TRANSFER_MINUS.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.TRANSFER_MINUS.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.CANCEL_TRANSFER_MINUS.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.CANCEL_TRANSFER_MINUS.getDesc());
            }else if(TextUtils.equals(data.getLogType(), ScoreTypeConfigs.TRANSFER_PLUS.getTag())){
                setText(R.id.tv_score_name,ScoreTypeConfigs.TRANSFER_PLUS.getDesc());
            }
            setText(R.id.tv_score_time,data.getCreatedDatetime());
            setText(R.id.tv_score_value,data.getAmount());
        }
    }
}
